package com.njtoyo.taxi.admin.rest.controller.open;

import com.njtoyo.taxi.admin.aop.LoggerManage;
import com.njtoyo.taxi.admin.aop.PassToken;
import com.njtoyo.taxi.admin.rest.wrapper.open.simple_call.CreateSimpleCallWrapper;
import com.njtoyo.taxi.admin.service.open.OpenSimpleCallService;
import com.taxi.entity.common.RestResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/open/simple_call")
@Api(tags = "电召")
public class OpenSimpleCallController {

    @Autowired
    private OpenSimpleCallService simpleCallService;

    @PostMapping()
    @ApiOperation(value = "添加电召记录", notes = "新增电召记录，公共接口，无权限校验")
    @LoggerManage(description = "添加电召记录")
    @PassToken
    public RestResult create(@Valid @RequestBody CreateSimpleCallWrapper wrapper) {
        return simpleCallService.createBacklog(wrapper);
    }

    @GetMapping("/get_upload_token")
    @ApiOperation(value = "获取上传的token", notes = "无需权限")
    @LoggerManage(description = "获取电召语音上传的token")
    @PassToken
    public RestResult getActivityToken() {
        return simpleCallService.getUploadToken();
    }
}
